import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
import '../styles/globals.css';
import { SessionProvider } from 'next-auth/react';
import { getServerSession } from 'next-auth';
import Header from './components/Header';
import Sidebar from './components/Sidebar';

const inter = Inter({ subsets: ['latin'] });

export const metadata: Metadata = {
  title: 'VisualDL Hub',
  description: '一个面向非专业机器学习开发者的可视化人机交互系统',
  keywords: ['机器学习', '深度学习', '可视化', 'AI', '模型训练'],
  icons: {
    icon: '/favicon.ico',
  },
};

export default async function RootLayout({ children }: { children: React.ReactNode }) {
  const session = await getServerSession();

  return (
    <SessionProvider session={session}>
      <html lang="zh-CN" className={inter.className}>
        <body className="min-h-screen">
          <div className="flex flex-col min-h-screen">
            <Header />
            <div className="flex flex-1">
              {session && <Sidebar />}
              <main className={`flex-1 p-4 md:p-6 ${session ? 'md:ml-64' : ''}`}>
                {children}
              </main>
            </div>
          </div>
        </body>
      </html>
    </SessionProvider>
  );
}